class TeacherInforsController < ApplicationController
  layout :determin_layout
  
    def index
      @teachers = User.find(:all,:conditions =>["juese = ?","教师"]) 
    end
    def show
      @teacher_infor = User.find(params[:id])
    end
    def edit
      @teacher_infor = User.find(params[:id])
    end
   def update
    @teacher_infor = User.find(params[:teacher_infor][:id])

    respond_to do |format|
      if @teacher_infor.update_attributes(params[:teacher_infor])
        flash[:notice] = '更新个人信息成功.'
        format.html { redirect_to teachers_path(@teacher_infor) }
      else
        format.html { redirect_to kechengs_path(@teacher_infor) }
      end
    end
  end
  def upd
    @teacher_infor = User.find(params[:teacher_infor][:id])

    respond_to do |format|
      if @teacher_infor.update_attributes(params[:teacher_infor])
        flash[:notice] = '更新个人信息成功.'
        format.html { redirect_to "/teachers" }
      else
        format.html { redirect_to kechengs_path(@teacher_infor) }
      end
    end
  end
end
